package com.sjtu.dao.model;

import com.sjtu.constants.AuthenticationConstants;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.SQLDelete;

import javax.persistence.*;

/**
 * nerine
 * 1/28/2020
 */
@SQLDelete(sql="UPDATE user_account SET is_deleted = 1 WHERE id_User_Account = ?")
@Getter
@Setter
@ToString
@Entity(name = "user_account")
public class UserAccount extends BaseModel {
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    private String idUserAccount;
    /** 账号id */
    private String userId;
    /** 账号中文名 */
    private String userName;
    /** 密码 */
    private String password;
    /** 对应的子系统 */
    @OneToOne
    @JoinColumn(name = "id_client_info")
    private ClientInfo clientInfo;
    /** 角色权限 */
    @Enumerated(EnumType.STRING)
    private AuthenticationConstants.RoleType role;
}
